﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using secondhand.L2busslogic;
using secondhand.L1database;
using secondhand.L3object;
using System.Drawing;
namespace secondhand.L4view
{
    public partial class search : System.Web.UI.Page
    {
        private static string pubtext;//保À¡ê存ä?查¨¦询¡¥语®?句?
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }


        protected void Button1_Click(object sender, EventArgs e)
        {
           


            goodsOBList tempList = new goodsOBList();
            tempList = goodsBL.Getgoosmo(TextBox1.Text);

            if (tempList.Count == 0)// && tempList2.Count == 0)
            {
                Label2.Visible = true;

            }
            
            GridView1.DataSource = tempList;//数据导入gridview
            GridView1.DataBind();
            GridView1.Visible = true;
            if (tempList != null)
            {
                tempList.Clear();
                tempList = null;
                GC.Collect();
            }

            xijie.Style["Display"] = "block";
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
           
            goodsOBList tempList = new goodsOBList();
            tempList = goodsBL.Getgotypesmo(TextBox3.Text);

            if (tempList.Count == 0)// && tempList2.Count == 0)
            {
                Label2.Visible = true;

            }

            GridView1.DataSource = tempList;//数据导入gridview
            GridView1.DataBind();
            GridView1.Visible = true;
            if (tempList != null)
            {
                tempList.Clear();
                tempList = null;
                GC.Collect();
            }

            xijie.Style["Display"] = "block";
         

        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            goodsOBList tempList = new goodsOBList();
            tempList = goodsBL.Getgoprice(TextBox2w.Text);

            if (tempList.Count == 0)// && tempList2.Count == 0)
            {
                Label2.Visible = true;

            }

            GridView1.DataSource = tempList;//数据导入gridview
            GridView1.DataBind();
            GridView1.Visible = true;
            if (tempList != null)
            {
                tempList.Clear();
                tempList = null;
                GC.Collect();
            }

            xijie.Style["Display"] = "block";

        }
        protected void Button4_Click(object sender, EventArgs e)
        {
           


             goodsOBList tempList = new goodsOBList();
            tempList = goodsBL.Getsalersmo(TextBox2.Text);

            if (tempList.Count == 0)// && tempList2.Count == 0)
            {
                Label2.Visible = true;

            }

            GridView1.DataSource = tempList;//数据导入gridview
            GridView1.DataBind();
            GridView1.Visible = true;
            if (tempList != null)
            {
                tempList.Clear();
                tempList = null;
                GC.Collect();
            }

            xijie.Style["Display"] = "block";


        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
        
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)//效果
        {
            e.Row.Attributes.Add("style", "height:30px");
            int i;
            //执行循环，保证每条数据都可以更新
            for (i = -1; i < GridView1.Rows.Count; i++)
            {
                //首先判断是否是数据行
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    //当鼠标停留时更改背景色
                    e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E1C4FF'");
                    //当鼠标移开时还原背景色
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
                }
                System.Drawing.ColorConverter colConvert = new System.Drawing.ColorConverter();
                System.Drawing.ColorConverter colConvert2 = new System.Drawing.ColorConverter();
                if (i >= 0)
                {
                    if (i % 2 == 1)
                    {
                        GridView1.Rows[i].BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#F4FAFF"); //Color.White;


                    }
                    else
                    {
                        GridView1.Rows[i].BackColor = (System.Drawing.Color)colConvert2.ConvertFromString("#D9ECFF");// Color.BlueViolet;
                    }
                    GridView1.Rows[i].Cells[2].ForeColor = Color.Green;

                    //  GridView1.Rows[i].Cells[0].ForeColor = Color.Green;
                    /*  if (GridView1.Rows[i].Cells[9].Text != "正常")
                      {


                          GridView1.Rows[i].Cells[9].ForeColor = Color.Yellow;
                      }*/
                }

            }

        }
      /*  protected void TextBox1w_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TextBox2w_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TextBox2_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {

        }*/
       
       
       
        protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {

        }
        protected void lbtnUp_Click(object sender, EventArgs e)
        {
            string d = ((LinkButton)sender).CommandArgument;
            Session["goods_Name1"] = d;
            Response.Redirect("~/L4View/search_list.aspx");
        }

        protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
        {

        }
    }
}